//
//  UnRegisterView.m
//  HeartWorld
//
//  Created by zhangji on 2016/10/13.
//  Copyright © 2016年 谭明权. All rights reserved.
//

#import "UnRegisterView.h"

@implementation UnRegisterView

- (instancetype)initWithCardFrame:(CGRect)frame
{
    self = [super initWithCardFrame:frame];
    if (self)
    {
        [self setUpView];
    }
    return self;
}

- (void)setUpView
{
    
    
    UIView * whiteView = [UIView new];
    whiteView.layer.cornerRadius = 5.f;
    whiteView.backgroundColor = [UIColor whiteColor];
    [self addSubview:whiteView];
//
    CGFloat padding = 50.f;
    [whiteView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(padding);
        make.right.equalTo(self.mas_right).offset(-padding);
        make.top.equalTo(self.mas_top).offset(150);
        make.height.equalTo(@(350));
    }];
    
    
    UIImageView * imgView = [UIImageView new];
    imgView.image = [UIImage imageNamed:@"gantanhao"];
    imgView.backgroundColor = [UIColor clearColor];
    [whiteView addSubview:imgView];
    
    [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(@(130));
        make.height.equalTo(@(130));
        make.centerX.equalTo(whiteView.mas_centerX);
        make.top.equalTo(whiteView.mas_top).offset(30);
    }];
    
    UILabel * label = [UILabel new];
    label.text = @"未认证";
    label.font = [UIFont boldSystemFontOfSize:20.f];
    label.textAlignment = NSTextAlignmentCenter;
    [whiteView addSubview:label];
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(whiteView.mas_left).offset(0);
        make.right.equalTo(whiteView.mas_right).offset(0);
        make.top.equalTo(imgView.mas_bottom).offset(30);
        
    }];
    
    UIButton * leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    leftBtn.backgroundColor = [UIColor colorWithHexString:@"0xC1C1C1"];
    leftBtn.layer.cornerRadius = 5.f;
    [leftBtn addTarget:self action:@selector(close) forControlEvents:UIControlEventTouchUpInside];
    [leftBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [leftBtn setTitle:@"确定" forState:UIControlStateNormal];
    [whiteView addSubview:leftBtn];
    
    [leftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(whiteView.mas_bottom).offset(-40);
        make.left.equalTo(whiteView.mas_left).offset(40);
        make.width.equalTo(@(80));
        make.height.equalTo(@(50));
    }];
    
    UIButton * rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    rightBtn.layer.cornerRadius = 5.f;
    rightBtn.backgroundColor = [UIColor colorWithHexString:@"0xDC6C59"];
    [rightBtn setTitle:@"去认证" forState:UIControlStateNormal];
    [rightBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [rightBtn addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
    [whiteView addSubview:rightBtn];
    
    [rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(whiteView.mas_right).offset(-40);
        make.bottom.equalTo(whiteView.mas_bottom).offset(-40);
        make.width.equalTo(@(80));
        make.height.equalTo(@(50));

    }];
    
}


#pragma mark  - Event

- (void)close
{
    [self hiddenCard];
    
    
}

- (void)click
{
    
    [self hiddenCard];
    
    if (self.gotoRegist)
    {
        self.gotoRegist();
    }
}




@end
